import request from "../utils/request"

const getCateListApi = () => {
  return request({
    method: 'get',
    url: '/my/cate/list'
  })
}

const addCateApi = (addForm) => {
  return request({
    method: 'post',
    url: '/my/cate/add',
    data: addForm
  })
}


const getCateDatailApi = (id) => {
  return request({
    method: "get",
    url: "/my/cate/info",
    params: {
      id
    }
  })
}
// 修改文章分类
const upDateCateApi = (editForm) => {
  return request({
    method: "put",
    url: "/my/cate/info",
    data: editForm
  })
}

// 删除文章分类
const delCateApi = (id) => {
  return request({
    method: "delete",
    url: "/my/cate/del",
    params: {
      id
    }
  })
}

// 发表文章
const pubArtacleApi = (pubForm) => {
  return request({
    method: 'post',
    url: '/my/article/add',
    data: pubForm
  })
}

// 获取文章列表
const getArtListApi = (q) => {
  return request({
    method: 'get',
    url: '/my/article/list',
    params: q
  })
}

// 获取文章详情
const getArtDetailApi = (id) => {
  return request({
    method: 'get',
    url: '/my/article/info',
    params: {
      id
    }
  })
}

// 删除文章
const delArtApi = (id) => {
  return request({
    method: "delete",
    url: '/my/article/info',
    params: {
      id
    }
  })
}
export {
  getCateListApi,
  addCateApi,
  getCateDatailApi,
  upDateCateApi,
  delCateApi,
  pubArtacleApi,
  getArtListApi,
  getArtDetailApi,
  delArtApi
}
